package by.alex.dzeshko.lastfmsimple.bo;

import java.util.List;

import org.json.JSONException;
import org.json.JSONObject;

import by.alex.dzeshko.lastfmsimple.bo.common.JSONModel;

public class TrackModel extends JSONModel {

	private static final String ARTIST = "artist";
	private static final String SUMMARY = "summary";
	private static final String WIKI = "wiki";
	private static final String TRACK = "track";
	private static final String TRACKMATCHES = "trackmatches";
	private static final String DURATION = "duration";

	public TrackModel() {
		super();
	}
	
	public TrackModel(JSONObject jsonObject) {
		super(jsonObject);
	}

	public TrackModel(String jsonString) throws JSONException {
		super(jsonString);
	}
	
	@Override
	public String getName() throws JSONException {
		return super.getName();
	}
	
	@Override
	public String getMbid() throws JSONException {
		return super.getMbid();
	}
	
	@Override
	public String getUrl() throws JSONException {
		return super.getUrl();
	}
	
	public String getDuration() throws JSONException {
		return getString(DURATION);
	}
	
	public String getArtist() throws JSONException {
		return getString(ARTIST);
	}
	
	@Override
	public String getImage(int size) throws JSONException {
		return super.getImage(size);
	}
	
	public static List<JSONObject> getTrackList(Object source) throws JSONException {
		return getObjectsList(source, TRACKMATCHES, TRACK);
	}
	
	public String getSummary() throws JSONException {
		return getStringFromObject(WIKI, SUMMARY);
	}
}
